from manimlib import *

sys.path.append('.')
from customized import *


class p1(ThreeDScene):
    def construct(self):
        # self.camera.frame.save_state()
        # self.add(NumberPlane())
        # self.camera.frame.rotate(13*DEGREES,about_point=[0.0, 0.0, 1.0])
        np = CustomizedSquare(1).get_grid(5, 5, buff=0)
        a, b = [-2.5, -2.5, 0], [2.5, 2.5, 0]
        self.add(np,
                 Dot(a).set_color(LV),
                 Dot(b).set_color(JH),
                 CustomizedTex('A').next_to(a, DL),
                 CustomizedTex('B').next_to(b, UR)
                 )


class p2(ThreeDScene):
    def construct(self):
        # self.camera.frame.save_state()
        # self.add(NumberPlane())
        # self.camera.frame.rotate(13*DEGREES,about_point=[0.0, 0.0, 1.0])
        t=5
        np = CustomizedSquare(1/t).get_grid(5*t, 5*t, buff=0)
        a, b = [-2.5, -2.5, 0], [2.5, 2.5, 0]
        self.add(np,
                 Dot(a).set_color(LV),
                 Dot(b).set_color(JH),
                 CustomizedTex('A').next_to(a, DL),
                 CustomizedTex('B').next_to(b, UR)
                 )
        # p2
        s = CustomizedSquare().stretch(5, 1).set_color(WHITE,False).set_fill(WHITE, 1).rotate_about_origin(PI / 4).set_stroke(WHITE)
        self.add(s,
                 CustomizedTex(r'\cdots')
                 )


class p3(ThreeDScene):
    def construct(self):
        # self.camera.frame.save_state()
        # self.add(NumberPlane())
        # self.camera.frame.rotate(13*DEGREES,about_point=[0.0, 0.0, 1.0])
        np = CustomizedSquare(1).get_grid(5, 5, buff=0)
        a, b = [-2.5, -2.5, 0], [2.5, 2.5, 0]
        self.add(np,
                 Dot(a).set_color(LV),
                 Dot(b).set_color(JH),
                 CustomizedTex('A').next_to(a, DL),
                 CustomizedTex('B').next_to(b, UR)
                 )
        for i in range(6):
            self.add(
                Dot(a).set_color(RED).shift(DR*i+UP*5)
            )

